<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="../css/public.css">
<link rel="stylesheet" type="text/css" href="../jquery-ui-1.11.4.custom/jquery-ui.css">
<script type="text/javascript" charset="utf-8" src="../jquery-ui-1.11.4.custom/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../jquery-ui-1.11.4.custom/jquery-ui.min.js"></script>
<title>修改班费信息</title>
</head>
<script>
  $(document).ready(function() {
    $("#choseDate").datepicker({
    	dateFormat : 'yy-mm-dd',
		yearSuffix : '年',
		showMonthAfterYear : true,
		monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月',
				'九月', '十月', '十一月', '十二月' ],
		dayNamesMin : [ '日', '一', '二', '三', '四', '五', '六' ]
    });
  });
  
  function f1() {
		frm1.action="classfeeupdate.jsp";
		frm1.submit();
		}
	function f2() {
		frm1.action="classfeedelete.jsp";
		frm1.submit();
	}
  </script>
<body>
<div id="maincontent">
<div id="headGray">
<%
    String managerName = (String) session.getAttribute("managerName");
	String classId = (String) session.getAttribute("classId");
	if(managerName == null)
    	out.println("<script>alert('没有登录,请返回登录界面进行登录！');window.location='../managerLogin.html';</script>");
    String classFeeId = request.getParameter("classFeeId");
    session.setAttribute("classFeeId",classFeeId);
    //System.out.println("classId"+classId);
    try
    {
    	 Class.forName("com.mysql.jdbc.Driver").newInstance();
     	 Connection con = java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3306/classfee", "root", "1234");
     	 Statement stmt = con.createStatement();
	     ResultSet rs=stmt.executeQuery("select * from tb_classfee");
		 int t=0;
		 while(rs.next())
		 {
			if(classFeeId.equals(rs.getString("classFeeId")))
			{
				t++;
				break;
			}
		 }
		 rs.close();
		 if(t==0)
			out.println("<script>alert('没有相应的班费信息!');window.location='classfeeup.jsp'</script>");
		 else
		 {
	       	ResultSet rst = stmt.executeQuery("SELECT * FROM  tb_student where classId='"+classId+"' order by stuId asc");
%>
<ul class="nopoint"><li><img src="../image/head.png" style="width:30px;height:30px"/><a id="maname" href="../tb_manager/managerupdate1.jsp" style="color:white;text-decoration: none;"><% out.println(managerName);%></a><a href="../managerlogout.jsp" style="margin-left:89%;color:white">退出登录</a></li></ul>
</div>
<div id="textArea-up">
<form action="classfeeupdate.jsp" method="post" name="frm1">
<ul class="nopoint">
<li><label for="stuId">学生姓名:</label></li>
<li><select name="stuId"  id="stuId"><%while(rst.next()){%><option value=<%out.println(rst.getInt("stuId")); %>><%out.println(rst.getString("stuName")); %></option><%}%><%rst.close();ResultSet srt = stmt.executeQuery("SELECT * FROM  tb_classFee where classFeeId='"+classFeeId+"'");while(srt.next()){ %></select></li>
<li><label for="inFee">上缴班费金额:</label></li>
<li><input type="text" id="inFee" value=<%out.println(srt.getInt("inFee")); %> name="inFee"></li>
<li><label for="outFee">支出班费金额:</label></li>
<li><input type="text" id="outFee" value=<%out.println(srt.getInt("outFee")); %> name="outFee"></li>
<li><label for="choseDate">日期:</label></li>
<li><input id="choseDate" type="text" value=<%out.println(srt.getString("date")); %> name="date"></li>
<li><label for="useWay">支出用途:</label></li>
<li><input type="text" id="choseWay" value=<%out.println(srt.getString("useWay")); %> name="useWay"></li>
<li id="libutton"><input id="upB" type="button" value="修  改" style="width:100px;height:40px" onclick="f1()">
<input id="deB" type="button" value="删 除" style="width:100px;height:40px;background:#66B3FF;" onclick="f2()"></li>
</ul>
<%    }	 
srt.close();
		}
		 con.close();
		 stmt.close();
    }
   catch(Exception e)
   {
	   System.out.println(e.getMessage());
   }
    %>
</form>
</div>
</div>
</body>
</html>